<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>laypage</title>
    <link rel="stylesheet" href="/assets/layui/css/layui.css">
</head>
<body>
    <div id ='test'>
    </div>
    <script src="/assets/layui/layui.all.js"></script>
    <script>
        var util = layui.util;
        var layer = layui.layer;
        //执行

        var endTime = new Date(2020,1,1).getTime();
        var serverTime = new Date().getTime();

        util.countdown(endTime,serverTime,function (date,serverTime,timer) {
            var str = date[0] + '天' + date[1] + '时' +  date[2] + '分' + date[3] + '秒';       //包含的剩余的日期
            var st = new Date(serverTime);
            layui.$('#test').html('距离2020年1月1日还有：'+ str + ',当前时间:' + util.toDateString(st,'yyyy-MM-dd HH:mm:ss'));
        })
    </script>
</body>
</html>